import {
  createSelector,
  createFeatureSelector,
  ActionReducerMap
} from "@ngrx/store";
import * as fromSymbol from "./symbol.reducer";
import { ShareActions } from "../actions";
import * as fromRoot from "@/reducers";

export interface ShareState {
  symbol: fromSymbol.State;
}

export interface State extends fromRoot.State {
  share: ShareState;
}

export const reducers: ActionReducerMap<
  ShareState,
  ShareActions.ShareActionsUnion
> = {
  symbol: fromSymbol.reducer
};

export const getShareState = createFeatureSelector<State, ShareState>("share");

export const symbolLists = createSelector(
  getShareState,
  (state: any) => state.symbol.selectSymbolResponse.data
);

export const orderLists = createSelector(
  getShareState,
  (state: any) => state.symbol.selectOrderResponse.data
);
